﻿using MediatR;
using Traceability.Commont.Domains.ScratchTheFat;
using Traceability.Commont.DTOs.CommontFiles;
using Traceability.Commont.Infrastructures.Interfaces;
namespace U.Enterprise.Api.Applications.EndingOnly
{
    public class ProductionScratchesDelHandler:IRequestHandler<ProductionScratchesdeelCommond, Resqults>
    {

        private readonly IBateRepository<ProductionScratches> _ProductionScratches;

        public ProductionScratchesDelHandler(IBateRepository<ProductionScratches> productionScratches)
        {
            _ProductionScratches = productionScratches;
        }

        public async Task<Resqults> Handle(ProductionScratchesdeelCommond request, CancellationToken cancellationToken)
        {

            var list = new Resqults() { Code = 0 };



            var query = _ProductionScratches.GetAll().FirstOrDefault(x => x.ProductionScratchesId == request.ProductionScratchesId);

            if(query!=null)
            {
             
            }


           var Result=_ProductionScratches.Update(query);

            if (Result != null) {


                list.Code = 1;
            
            
            }

            return list;


        }
    }
}
